(**********************************************************************

    :Program.  	 IDCMP.def
    :Contents.	 Intuition Direct Communication Message Port handler
    :Author.   	 Nicolas Benezan [bne]
    :Address.    Postwiesenstr. 2, D7000 Stuttgart 60
    :Phone.      711/333679
    :Copyright.  Public Domain
    :Language. 	 Modula-2
    :Translator. M2Amiga AMSoft
    :ModHistory. V1.1b [bne] 24.10.88
    
**********************************************************************)

DEFINITION MODULE IDCMP;

FROM Intuition	IMPORT IDCMPFlags,IDCMPFlagSet,WindowPtr;
FROM SYSTEM	IMPORT ADDRESS;
FROM Exec	IMPORT MsgPortPtr;
FROM InputEvent	IMPORT QualifierSet;

PROCEDURE GetIntuiMessage(IDCMPort:MsgPortPtr;VAR Class:IDCMPFlags;
	VAR Code:CARDINAL;VAR Qualifier:QualifierSet;
        VAR ItemAdr:ADDRESS;VAR X,Y:INTEGER);
(*:Input.	IDCMPort: Pointer a userPort of a Window
  :Output.	Class,Code,Qualifier: InuiMessage InputEvent parameters
  :Output.	ItemAdr: Address of the IntuiMessage related Item
  :Output.	X,Y: Mouse coordinates
  :Semantic.	Waits for a message at an IDCMPort then gets and
  :Semantic.	replies it *)

PROCEDURE PollMessage(IDCMPort:MsgPortPtr;VAR Class:IDCMPFlags;
	VAR Code:CARDINAL;VAR Qualifier:QualifierSet;VAR ItemAdr:ADDRESS;
        VAR X,Y:INTEGER):BOOLEAN;
(*:Input.	IDCMPort: Pointer a userPort of a Window
  :Output.	Class,Code,Qualifier: InuiMessage InputEvent parameters
  :Output.	ItemAdr: Address of the IntuiMessage related Item
  :Output.	X,Y: Mouse coordinates
  :Result.	TRUE: Message recieved, outputs are valid
  :Result.	FALSE: Port was empty, outputs are zero/NIL
  :Semantic.	Gets and replies a message at an IDCMPort
  :Semantic.	Returns FALSE immediately if the Port is empty *)

PROCEDURE ActiveFlags(Window:WindowPtr):IDCMPFlagSet;
(*:Input.	Window: Pointer to the Window containing the Port
  :Input.	which is to be examined
  :Result.	Set of the Port's active Flags
  :Semantic.	Returns a Set of the set Flags of an IDCMPort *)

PROCEDURE EmptyIDCMP(IDCMPort:MsgPortPtr);
(*:Input.	IDCMPort: Pointer a userPort of a Window
  :Semantic.	Gets and replies all messages at the specified Port *)

END IDCMP.
